package model;

import parsing.RaceResultParsingInformation;
import utility.Utility;

public class RaceResult {
	private int overallRank ; 
	private int groupRank ; 
	private int sexRank ; 
	private int timeInSeconds ;
	private int meters = 8000 ; // the distance run - just short of 5 miles.

	public RaceResult(String dataString, RaceResultParsingInformation parsingInformation) {
		this.groupRank = Utility.getInt(dataString.substring(parsingInformation.getGroupRankStart(), parsingInformation.getGroupRankEnd()).trim()) ;
		this.overallRank = Utility.getInt(dataString.substring(parsingInformation.getOverallRankStart(), parsingInformation.getOverallRankEnd()).trim()) ;
		this.sexRank = Utility.getInt(dataString.substring(parsingInformation.getSexRankStart(), parsingInformation.getSexRankEnd()).trim()) ;
		this.timeInSeconds = Utility.computeTimeInSeconds(dataString.substring(parsingInformation.getTimeStart(), parsingInformation.getTimeEnd()).trim()) ;
	}

	public int getOverallRank() {
		return overallRank;
	}
	public int getGroupRank() {
		return groupRank;
	}
	public int getSexRank() {
		return sexRank;
	}
	public int getTimeInSeconds() {
		return timeInSeconds;
	}
	public int getMeters() {
		return meters;
	}
	@Override
	public String toString() {
		return "RaceResult [groupRank=" + groupRank + ", meters=" + meters
				+ ", overallRank=" + overallRank + ", sexRank=" + sexRank
				+ ", timeInSeconds=" + timeInSeconds + "]";
	}

	
	
}
